<?php $this->load->view('layout/header'); ?>
<div class="supplier-content-page">
    <div class="product-test-h5">
        <ul class="breadcrumb">
            <li><a href="javascript:;">退款审核</a></li>
            <li><a href="<?php echo site_url('tourismorderrefund/grid') ?>">商品管理</a></li>
            <li class="active"><a href="<?php echo site_url('tourismorderrefund/add') ?>">退款详情</a></li>
        </ul>
        <?php echo execute_alert_message(); ?>
        <div class="add-product table-infom">
            <table class="table">
                <thead>
                    <tr>
                        <th>商品名称</th>
                        <th>销售价/供应价</th>
                        <th>购买数量</th>
                        <th>退货数量</th>
                        <th>换货数量</th>
                        <th>实际应付（元）</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td class="baobei">
                            <div class="media">
                                <div class="media-left">
                                    <a target="_blank" href="<?php echo $this->config->wap_base_url.'tourismgoods/info/'.$examine->goods_attr_id.'.html' ?>">
                                        <img class="media-object lazy" src="skins/images/load.jpg" data-original="<?php echo $this->config->show_image_url($examine->goods_image, '300-300') ?>" style="width: 80px; height: 80px;">
                                    </a>
                                </div>
                                <div class="media-body">
                                    <h4 class="media-heading"><?php echo $examine->goods_name ?></h4>
                                    <span><?php echo $examine->attribute_value ?></span>
                                </div>
                            </div>
                        </td>
                        <td><?php echo $examine->shop_price; ?> / <?php echo $examine->supply_price; ?></td>
                        <td><?php echo $examine->number?></td>
                        <td><?php echo bcsub($examine->number, $examine->refund_num, 0);?></td>
                        <td><?php echo $examine->barter_num?></td>
                        <td><?php echo $examine->pay_amount;?></td>
                    </tr>
                </tbody>
            </table>
        </div>
        <form class="public-validate-form form-horizontal" action="<?php echo site_url('tourismorderrefund/examinePost') ?>" method="post" enctype="multipart/form-data" id="tourismorderrefund_form">
            <div class="row">
                <div class="col-lg-8">
                    <div class="add-product">
                        <div class="fonter">基本信息</div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">联系人：</label>
                            <div class="col-xs-6">
                                <span class="text-primary"><?php echo $examine->user_name ?></span>
                                <input type="hidden" name="refund_id" value="<?php echo $examine->refund_id ?>">
                                <input type="hidden" name="order_id" value="<?php echo $examine->order_id ?>">
                                <input type="hidden" name="goods_attr_id" value="<?php echo $examine->goods_attr_id ?>">
                                <input type="hidden" name="refund_num" value="<?php echo $examine->number ?>">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">联系电话：</label>
                            <div class="col-xs-6">
                                <span class="text-primary"><?php echo $examine->cellphone ?></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">退款原因：</label>
                            <div class="col-xs-6">
                                <span><?php echo $examine->refund_content ?></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">附件：</label>
                            <div class="col-xs-6">
                                <a target="_blank" href="<?php echo $this->config->show_image_url($examine->images) ?>">
                                    <img src="skins/images/load.jpg" data-original="<?php echo $this->config->show_image_url($examine->images) ?>" width="150" height="150">
                                </a>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label"><em>* </em>退款状态：</label>
                            <div class="col-xs-3">
                                <select name="status" class="form-control required" id="status" autocomplete="off" <?php if ($examine->status != 1) :?>disabled="disabled"<?php endif;?>>
                                    <?php foreach (array(1 => '未审核', 2 => '同意', 3 => '拒绝') as $key => $value) : ?>
                                        <option value="<?php echo $key ?>" <?php if ($examine->status == $key): ?>selected="selected" <?php endif; ?>><?php echo $value ?></option>
                                    <?php endforeach; ?>
                                </select>
                            </div>
                        </div>
                        <div class="form-group reject-content" <?php if ($examine->status != 3): ?> style="display: none"<?php endif; ?>>
                            <label class="col-sm-1 control-label"><em>* </em>拒绝原因：</label>
                            <div class="col-xs-7">
                                <textarea name="reject_content" rows="3" minlength="6" class="form-control required"><?php echo trim($examine->reject_content) ?></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">申请时间：</label>
                            <div class="col-xs-6">
                                <span><?php echo $examine->created_at ?></span>
                            </div>
                        </div>
                        <?php if ($examine->verify_time != '0000-00-00 00:00:00') :?>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">审核时间：</label>
                            <div class="col-xs-6">
                                <span><?php echo $examine->verify_time ?></span>
                            </div>
                        </div>
                        <?php endif;?>
                        <div class="supplierlist-submit">
                            <button class="btn btn-default" type="submit">确认保存</button> 
                            <a href="<?php echo site_url('tourismorderrefund/grid') ?>"> 返回上一步</a>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4 refund-barter-logistics">
                <?php if(isset($logistics) && $logistics->num_rows() > 0): ?>
                    <?php $logistics = $logistics->row(); ?>
                    <i class="sjicon"></i>
                    <p class="col-lebel">
                        <span>物流公司：<?php echo $logistics->name;?></span>
                        <span>运单号：<?php echo $logistics->number;?></span>
                    </p>
                    <div class="col-scroll">
                        <table width="520px" cellspacing="0" cellpadding="0" border="0" class="express-table">
                            <tbody>
                            <tr>
                                <th width="163" >时间</th>
                                <th width="354" >地点和跟踪进度</th>
                            </tr>
                            <?php if(!empty($logistics->context)): ?>
                                <?php $data = json_decode($logistics->context); ?>
                                <?php foreach($data as $value): ?>
                                    <tr>
                                        <td width="163" ><?php echo $value->time; ?></td>
                                        <td width="354" ><?php echo $value->context; ?></td>
                                    </tr>
                                <?php endforeach ?>
                            <?php endif ?>
                            </tbody>
                        </table>
                    </div>
                <?php else: ?>
                    <span>快递单号未收录</span>
                <?php endif; ?>
                </div>
            </div>
        </form>
    </div>
</div>
<?php $this->load->view('layout/footer'); ?>
<script type="text/javascript">
    $('.supplier-content-page').on('change', '#status', function () {
        var key = $(this).val();
        if (key == 3) {
            $('.reject-content').show();
        } else {
            $('.reject-content').hide();
        }
    });
</script>
